
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>jquery</title>
		<link rel="stylesheet" type="text/css" href="../day03/css/bootstrap.min.css"/>
		<script src="./js/jquery.min.js"></script>
		<style type="text/css">
			body{
				background-color: rgba(197,204,178,50%);
			}
		</style>
	</head>
	<body>
		<div class="container" style="width: 300px;margin-top: 50px;">
			<fieldset>
				<legend>登录</legend>
				<div class="form-group">
					<label for="username">用户名：</label>
					<input class="form-control" 
						autocomplete="off"
						type="text" name="username" id="username" value="" />
				</div>
				<div class="form-group">
					<label for="password">密码：</label>
					<input class="form-control" 
						autocomplete="off" 
						type="password" name="password" id="password" value="" />
				</div>
				<div class="form-group">
					<!-- onclick 点击事件 -->
					<button id="btnSave" class="btn btn-primary" onclick="save()">保存</button>
					<button id="btnClear" class="btn btn-danger" onclick="jqclear()">取消</button>
				</div>
			</fieldset>
		</div>
	</body>
	<script type="text/javascript">
		function save(){
			// jquery 中的$就是 JavaScript 中的 document
			console.log($("#username").val());
			console.log($("#password").val());
		}
		function jqclear(){
			$("#username").val("");
			$("#password").val("");
		}
		$("#btnSave").click(function(){
			var username = $("#username");
			var password = $("#password");
			console.log( username.val() +":"+ password.val() )
		})
		$("#btnClear").click(function(){
			$("#username").val("");
			$("#password").val("");
		})
		
	</script>
</html>
